﻿Imports OMANE.Common.UI
Imports Actuariat
Imports System.Windows.Input
Imports OMANE.Common.Model.Parametrage

Namespace ViewModels
    Public Class ViewModelParamSelectionMedicale
        Inherits ViewModelCommand
        Implements IViewModelTabSection

        Public Property Icone As String Implements Common.UI.IViewModelTabSection.Icone
        Public Property Title As String Implements Common.UI.IViewModelTabSection.Title
        Public Property IsClosable As Boolean Implements IViewModelTabSection.IsClosable

        Private m_MoteurEcheancier As OMANE.Common.Model.Interfaces.IMoteur_Echeancier

#Region "Constructeur"
        ''' <summary>
        ''' Constructeur
        ''' </summary>
        ''' <remarks></remarks>
        Public Sub New(ByVal MoteurEcheancier As OMANE.Common.Model.Interfaces.IMoteur_Echeancier,
                       ByVal DisplayName As String,
                       ByVal Command As ICommand)
            MyBase.New(DisplayName, Command)
        End Sub
        Public Sub New()
        End Sub
#End Region

        Private _copySelMedicale As ParametreSelectionMedicale
        Public ReadOnly Property CopySelectionMedicale As ParametreSelectionMedicale
            Get
                If _copySelMedicale Is Nothing Then
                    With m_MoteurEcheancier
                        Dim TValeurs As DataTable = .SelectionMedicale.Valeurs.Copy
                        _copySelMedicale = New ParametreSelectionMedicale(.SelectionMedicale.Nom, .SelectionMedicale.Description, .SelectionMedicale.Methode_Cal, TValeurs)
                        _copySelMedicale.maxDeroulement = .SelectionMedicale.maxDeroulement
                    End With
                End If
                Return _copySelMedicale
            End Get
        End Property

        Public Property MaxDeroulement As Integer
            Get
                Return CopySelectionMedicale.maxDeroulement
            End Get
            Set(ByVal value As Integer)
                OnPropertyChanging("MaxDeroulement")
                OnPropertyChanging("Valeurs")
                CopySelectionMedicale.maxDeroulement = value
                OnPropertyChanged("MaxDeroulement")
                OnPropertyChanged("Valeurs")
            End Set
        End Property
        Public ReadOnly Property Valeurs As DataTable
            Get
                Return CopySelectionMedicale.Valeurs
            End Get
        End Property

        Public Sub Valider()
            m_MoteurEcheancier.SelectionMedicale = _copySelMedicale
        End Sub
    End Class
End Namespace
